package org.ap.demo.api.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Service;

@Service("chargingCheck")
public class ChargingCheck {

	public boolean check(Authentication authentication, HttpServletRequest request){
        //如果能获取到Principal对象不为空证明，授权已经通过
        Object principal  = authentication.getPrincipal();
        if(principal  != null){
            //获取请求登录的url
            System.out.println(principal) ;
            return true;
        }
        return false;
  }
}
